package com.health.system.model.system;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.health.system.javacommon.base.BaseEntity;

/**
 * <p>Title: 平台操作员 POJO </p>
 * <p>Description:  </p>
 * Copyright: Copyright (c) 2011-04
 * Company: 
 * 
 * @author 
 * @version 1.1 
*/

public class User extends BaseEntity {
	
	//date formats
	public static final String FORMAT_BIRTHDAY_ = DATE_TIME_FORMAT;
	public static final String FORMAT_REGDATE_ = DATE_TIME_FORMAT;
	public static final String FORMAT_LASTLOGIN_DATE_ = DATE_TIME_FORMAT;
	public static final String  BIRTHDAY_DATE = DATE_FORMAT;
	//columns STAR 
	
	/**用户ID*/
	private java.lang.String id;
	/**操作员登录账号*/
	private java.lang.String name;
	/**操作员登录密码*/
	private java.lang.String password;
	/**操作员登录真实姓名*/
	private java.lang.String realname;
	/**性别*/
	private java.lang.String sex;
	/**所属机构ID:和组织机构表id_关联*/
	private java.lang.String company;
	/**工作电话*/
	private java.lang.String worktel;
	/**操作员手机号*/
	private java.lang.String mobiletel1;
	/**操作员备用*/
	private java.lang.String mobiletel2;
	/**操作员传真*/
	private java.lang.String fax;
	/**生日*/
	private java.sql.Date birthday;
	/**生日 字符串*/
	private java.lang.String birthdayString;
	/**电子邮件*/
	private java.lang.String email;
	/**家庭住址*/
	private java.lang.String address;
	/**邮编*/
	private java.lang.String postalcode;
	/**身份证*/
	private java.lang.String idcard;
	/**状态:禁用:1-初始化，2-开通，4-暂停，5-停止*/
	private java.lang.Integer blocked;
	/**开通时间*/
	private java.sql.Timestamp regdate;
	/**最后登录时间*/
	private java.sql.Timestamp lastloginDate;
	/**登录次数*/
	private java.lang.String regdateString;
	/***/
	private java.lang.String lastloginDateString;
	/***/
	private java.lang.Integer logincount;
	/***/
	private java.lang.String roleId;
	/**新密码1*/
	private java.lang.String passwordNew1;
	/**新密码2*/
	private java.lang.String passwordNew2;
	
	/**性别*/
	private java.lang.String sexVal;
	/***/
	private java.lang.String sexNew;
	/**所属机构代码:和组织机构表CP_NAME_关联*/
	private java.lang.String companyName;
	/***/
	private java.lang.String blockedValue;
	/**  bzq add 所属机构代码:和组织机构表CP_CODE_关联 */
	private java.lang.String cpCode;
	
 	private UserRole userRole;	
 	
 	private java.util.ArrayList idList;
 	/**操作员对应角色集合*/
 	private java.util.List roleIds;
	//columns END

	public java.lang.String getRoleId() {
		return roleId;
	}

	public void setRoleId(java.lang.String roleId) {
		this.roleId = roleId;
	}

	public User(){
	}

	public User(
		java.lang.String id
	){
		this.id = id;
	}

	public void setId(java.lang.String value) {
		this.id = value;
	}
	
	public java.lang.String getId() {
		return this.id;
	}
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	public java.lang.String getName() {
		return this.name;
	}
	public void setPassword(java.lang.String value) {
		this.password = value;
	}
	
	public java.lang.String getPassword() {
		return this.password;
	}
	public void setRealname(java.lang.String value) {
		this.realname = value;
	}
	
	public java.lang.String getRealname() {
		return this.realname;
	}
	public void setSex(java.lang.String value) {
		this.sex = value;
	}
	
	public java.lang.String getSex() {
		return this.sex;
	}
	public void setCompany(java.lang.String value) {
		this.company = value;
	}
	
	public java.lang.String getCompany() {
		if(null == company || "".equals(company)){
			this.companyName = "无";
		}
		return this.company;
	}
	public void setWorktel(java.lang.String value) {
		this.worktel = value;
	}
	
	public java.lang.String getWorktel() {
		return this.worktel;
	}
	public void setMobiletel1(java.lang.String value) {
		this.mobiletel1 = value;
	}
	
	public java.lang.String getMobiletel1() {
		return this.mobiletel1;
	}
	public void setMobiletel2(java.lang.String value) {
		this.mobiletel2 = value;
	}
	
	public java.lang.String getMobiletel2() {
		return this.mobiletel2;
	}
	public void setFax(java.lang.String value) {
		this.fax = value;
	}
	
	public java.lang.String getFax() {
		return this.fax;
	}
	public String getBirthdayString() {
		return date2String(getBirthday(), BIRTHDAY_DATE);
	}
	public void setBirthdayString(String value) {
		setBirthday(string2Date(value, BIRTHDAY_DATE,java.sql.Date.class));
	}
	
	public void setBirthday(java.sql.Date value) {
		this.birthday = value;
	}
	
	public java.sql.Date getBirthday() {
		return this.birthday;
	}
	public void setEmail(java.lang.String value) {
		this.email = value;
	}
	
	public java.lang.String getEmail() {
		return this.email;
	}
	public void setAddress(java.lang.String value) {
		this.address = value;
	}
	
	public java.lang.String getAddress() {
		return this.address;
	}
	public void setPostalcode(java.lang.String value) {
		this.postalcode = value;
	}
	
	public java.lang.String getPostalcode() {
		return this.postalcode;
	}
	public void setIdcard(java.lang.String value) {
		this.idcard = value;
	}
	
	public java.lang.String getIdcard() {
		return this.idcard;
	}
	public void setBlocked(Integer boolean1) {
		this.blocked = boolean1;
		}
	
	public java.lang.Integer getBlocked() {
		return this.blocked;
	}
	public String getRegdateString() {
		return date2String(getRegdate(), FORMAT_REGDATE_);
	}
	public void setRegdateString(String value) {
		setRegdate(string2Date(value, FORMAT_REGDATE_,java.sql.Timestamp.class));
	}
	
	public void setRegdate(java.sql.Timestamp value) {
		this.regdate = value;
	}
	
	public java.sql.Timestamp getRegdate() {
		return this.regdate;
	}
	public String getLastloginDateString() {
		return date2String(getLastloginDate(), FORMAT_LASTLOGIN_DATE_);
	}
	public void setLastloginDateString(String value) {
		setLastloginDate(string2Date(value, FORMAT_LASTLOGIN_DATE_,java.sql.Timestamp.class));
	}
	
	public void setLastloginDate(java.sql.Timestamp value) {
		this.lastloginDate = value;
	}
	
	public java.sql.Timestamp getLastloginDate() {
		return this.lastloginDate;
	}
	public void setLogincount(java.lang.Integer value) {
		this.logincount = value;
	}
	
	public java.lang.Integer getLogincount() {
		return this.logincount;
	}

	public String toString() {
		return new ToStringBuilder(this)
			.append("Id",getId())
			.append("Name",getName())
			.append("Password",getPassword())
			.append("Realname",getRealname())
			.append("Sex",getSex())
			.append("Company",getCompany())
			.append("CompanyName",getCompanyName())
			.append("Worktel",getWorktel())
			.append("Mobiletel1",getMobiletel1())
			.append("Mobiletel2",getMobiletel2())
			.append("Fax",getFax())
			.append("Birthday",getBirthday())
			.append("Email",getEmail())
			.append("Address",getAddress())
			.append("Postalcode",getPostalcode())
			.append("Idcard",getIdcard())
			.append("Blocked",getBlocked())
			.append("Regdate",getRegdate())
			.append("LastloginDate",getLastloginDate())
			.append("Logincount",getLogincount())
			.append("SexNew",getSexNew())
			.append("UserRole",getUserRole())
			.append("BlockedValue",getBlockedValue())
			.append("CpCode",getCpCode())
			 
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.append(getName())
			.append(getPassword())
			.append(getRealname())
			.append(getSex())
			.append(getCompany())
			.append(getCompanyName())
			.append(getWorktel())
			.append(getMobiletel1())
			.append(getMobiletel2())
			.append(getFax())
			.append(getBirthday())
			.append(getEmail())
			.append(getAddress())
			.append(getPostalcode())
			.append(getIdcard())
			.append(getBlocked())
			.append(getRegdate())
			.append(getLastloginDate())
			.append(getLogincount())
			.append(getSexNew())
			.append(getUserRole())
			.append(getBlockedValue())
			.append(getCpCode())
			
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof User == false) return false;
		if(this == obj) return true;
		User other = (User)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getName(),other.getName())
			.append(getPassword(),other.getPassword())
			.append(getRealname(),other.getRealname())
			.append(getSex(),other.getSex())
			.append(getCompany(),other.getCompany())
			.append(getCompanyName(),other.getCompanyName())
			.append(getWorktel(),other.getWorktel())
			.append(getMobiletel1(),other.getMobiletel1())
			.append(getMobiletel2(),other.getMobiletel2())
			.append(getFax(),other.getFax())
			.append(getBirthday(),other.getBirthday())
			.append(getEmail(),other.getEmail())
			.append(getAddress(),other.getAddress())
			.append(getPostalcode(),other.getPostalcode())
			.append(getIdcard(),other.getIdcard())
			.append(getBlocked(),other.getBlocked())
			.append(getRegdate(),other.getRegdate())
			.append(getLastloginDate(),other.getLastloginDate())
			.append(getLogincount(),other.getLogincount())
			.append(getSexNew(),other.getSexNew())
			.append(getUserRole(),other.getUserRole())
			.append(getBlockedValue(),other.getBlockedValue())
			.append(getCpCode(),other.getCpCode())
			.isEquals();
	}

	public java.lang.String getPasswordNew1() {
		return passwordNew1;
	}

	public void setPasswordNew1(java.lang.String passwordNew1) {
		this.passwordNew1 = passwordNew1;
	}

	public java.lang.String getPasswordNew2() {
		return passwordNew2;
	}

	public void setPasswordNew2(java.lang.String passwordNew2) {
		this.passwordNew2 = passwordNew2;
	}

	public java.lang.String getSexVal() {
		if("1".equals(sex)){
			this.setSexVal("女");
		}else{
			this.setSexVal("男");
		}
		return this.sexVal;
	}

	public void setSexVal(java.lang.String sexVal) {
		this.sexVal = sexVal;
	}

	public java.lang.String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(java.lang.String companyName) {
		this.companyName = companyName;
	}

	public java.lang.String getSexNew() {
		return this.sexNew;
	}

	public void setSexNew(java.lang.String sexNew) {
		this.sexNew = sexNew;
	}

	public UserRole getUserRole() {
		return userRole;
	}

	public void setUserRole(UserRole userRole) {
		this.userRole = userRole;
	}
	/**
	 * 是','0' , ['否','1'
	 * @return
	 */
	public java.lang.String getBlockedValue() {
		if(this.blocked!=null && this.blocked==1){
			this.setBlockedValue("否");
		}else{
			this.setBlockedValue("是");
		}
		
		return this.blockedValue;
	}

	public void setBlockedValue(java.lang.String blockedValue) {
		this.blockedValue = blockedValue;
	}

	public java.util.ArrayList getIdList() {
		return idList;
	}

	public void setIdList(java.util.ArrayList idList) {
		this.idList = idList;
	}

	public java.util.List getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(java.util.List roleIds) {
		this.roleIds = roleIds;
	}

	public java.lang.String getCpCode() {
		return cpCode;
	}

	public void setCpCode(java.lang.String cpCode) {
		this.cpCode = cpCode;
	}
	 
}

